home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xpcom / nsIWeakReference.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  6KB  |  204 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIWeakReference.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIWeakReference_h__
  6. #define __gen_nsIWeakReference_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17.  
  18. /* starting interface:    nsIWeakReference */
  19. #define NS_IWEAKREFERENCE_IID_STR "9188bc85-f92e-11d2-81ef-0060083a0bcf"
  20.  
  21. #define NS_IWEAKREFERENCE_IID \
  22.   {0x9188bc85, 0xf92e, 0x11d2, \
  23.     { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
  24.  
  25. /**
  26.  * An instance of |nsIWeakReference| is a proxy object that cooperates with
  27.  * its referent to give clients a non-owning, non-dangling reference.  Clients
  28.  * own the proxy, and should generally manage it with an |nsCOMPtr| (see the
  29.  * type |nsWeakPtr| for a |typedef| name that stands out) as they would any
  30.  * other XPCOM object.  The |QueryReferent| member function provides a
  31.  * (hopefully short-lived) owning reference on demand, through which clients
  32.  * can get useful access to the referent, while it still exists.
  33.  *
  34.  * @status FROZEN
  35.  * @version 1.0
  36.  * @see nsISupportsWeakReference
  37.  * @see nsWeakReference
  38.  * @see nsWeakPtr
  39.  */
  40. class NS_NO_VTABLE nsIWeakReference : public nsISupports {
  41.  public: 
  42.  
  43.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWEAKREFERENCE_IID)
  44.  
  45.   /**
  46.      * |QueryReferent| queries the referent, if it exists, and like |QueryInterface|, produces
  47.      * an owning reference to the desired interface.  It is designed to look and act exactly
  48.      * like (a proxied) |QueryInterface|.  Don't hold on to the produced interface permanently;
  49.      * that would defeat the purpose of using a non-owning |nsIWeakReference| in the first place.
  50.      */
  51.   /* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  52.   NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) = 0;
  53.  
  54. };
  55.  
  56. /* Use this macro when declaring classes that implement this interface. */
  57. #define NS_DECL_NSIWEAKREFERENCE \
  58.   NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result); 
  59.  
  60. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  61. #define NS_FORWARD_NSIWEAKREFERENCE(_to) \
  62.   NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return _to QueryReferent(uuid, result); } 
  63.  
  64. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  65. #define NS_FORWARD_SAFE_NSIWEAKREFERENCE(_to) \
  66.   NS_IMETHOD QueryReferent(const nsIID & uuid, void * *result) { return !_to ? NS_ERROR_NULL_POINTER : _to->QueryReferent(uuid, result); } 
  67.  
  68. #if 0
  69. /* Use the code below as a template for the implementation class for this interface. */
  70.  
  71. /* Header file */
  72. class nsWeakReference : public nsIWeakReference
  73. {
  74. public:
  75.   NS_DECL_ISUPPORTS
  76.   NS_DECL_NSIWEAKREFERENCE
  77.  
  78.   nsWeakReference();
  79.  
  80. private:
  81.   ~nsWeakReference();
  82.  
  83. protected:
  84.   /* additional members */
  85. };
  86.  
  87. /* Implementation file */
  88. NS_IMPL_ISUPPORTS1(nsWeakReference, nsIWeakReference)
  89.  
  90. nsWeakReference::nsWeakReference()
  91. {
  92.   /* member initializers and constructor code */
  93. }
  94.  
  95. nsWeakReference::~nsWeakReference()
  96. {
  97.   /* destructor code */
  98. }
  99.  
  100. /* void QueryReferent (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result); */
  101. NS_IMETHODIMP nsWeakReference::QueryReferent(const nsIID & uuid, void * *result)
  102. {
  103.     return NS_ERROR_NOT_IMPLEMENTED;
  104. }
  105.  
  106. /* End of implementation class template. */
  107. #endif
  108.  
  109.  
  110. /* starting interface:    nsISupportsWeakReference */
  111. #define NS_ISUPPORTSWEAKREFERENCE_IID_STR "9188bc86-f92e-11d2-81ef-0060083a0bcf"
  112.  
  113. #define NS_ISUPPORTSWEAKREFERENCE_IID \
  114.   {0x9188bc86, 0xf92e, 0x11d2, \
  115.     { 0x81, 0xef, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf }}
  116.  
  117. /**
  118.  * |nsISupportsWeakReference| is a factory interface which produces appropriate
  119.  * instances of |nsIWeakReference|.  Weak references in this scheme can only be
  120.  * produced for objects that implement this interface.
  121.  *
  122.  * @status FROZEN
  123.  * @version 1.0
  124.  * @see nsIWeakReference
  125.  * @see nsSupportsWeakReference
  126.  */
  127. class NS_NO_VTABLE nsISupportsWeakReference : public nsISupports {
  128.  public: 
  129.  
  130.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISUPPORTSWEAKREFERENCE_IID)
  131.  
  132.   /**
  133.      * |GetWeakReference| produces an appropriate instance of |nsIWeakReference|.
  134.      * As with all good XPCOM `getters', you own the resulting interface and should
  135.      * manage it with an |nsCOMPtr|.
  136.      *
  137.      * @see nsIWeakReference
  138.      * @see nsWeakPtr
  139.      * @see nsCOMPtr
  140.      */
  141.   /* nsIWeakReference GetWeakReference (); */
  142.   NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) = 0;
  143.  
  144. };
  145.  
  146. /* Use this macro when declaring classes that implement this interface. */
  147. #define NS_DECL_NSISUPPORTSWEAKREFERENCE \
  148.   NS_IMETHOD GetWeakReference(nsIWeakReference **_retval); 
  149.  
  150. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  151. #define NS_FORWARD_NSISUPPORTSWEAKREFERENCE(_to) \
  152.   NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return _to GetWeakReference(_retval); } 
  153.  
  154. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  155. #define NS_FORWARD_SAFE_NSISUPPORTSWEAKREFERENCE(_to) \
  156.   NS_IMETHOD GetWeakReference(nsIWeakReference **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetWeakReference(_retval); } 
  157.  
  158. #if 0
  159. /* Use the code below as a template for the implementation class for this interface. */
  160.  
  161. /* Header file */
  162. class nsSupportsWeakReference : public nsISupportsWeakReference
  163. {
  164. public:
  165.   NS_DECL_ISUPPORTS
  166.   NS_DECL_NSISUPPORTSWEAKREFERENCE
  167.  
  168.   nsSupportsWeakReference();
  169.  
  170. private:
  171.   ~nsSupportsWeakReference();
  172.  
  173. protected:
  174.   /* additional members */
  175. };
  176.  
  177. /* Implementation file */
  178. NS_IMPL_ISUPPORTS1(nsSupportsWeakReference, nsISupportsWeakReference)
  179.  
  180. nsSupportsWeakReference::nsSupportsWeakReference()
  181. {
  182.   /* member initializers and constructor code */
  183. }
  184.  
  185. nsSupportsWeakReference::~nsSupportsWeakReference()
  186. {
  187.   /* destructor code */
  188. }
  189.  
  190. /* nsIWeakReference GetWeakReference (); */
  191. NS_IMETHODIMP nsSupportsWeakReference::GetWeakReference(nsIWeakReference **_retval)
  192. {
  193.     return NS_ERROR_NOT_IMPLEMENTED;
  194. }
  195.  
  196. /* End of implementation class template. */
  197. #endif
  198.  
  199. #ifdef MOZILLA_INTERNAL_API
  200. #include "nsIWeakReferenceUtils.h"
  201. #endif
  202.  
  203. #endif /* __gen_nsIWeakReference_h__ */
  204.